package com.zhang.sort;

/**
 * @author zhang
 * @time 2022/01/08 22:42:37
 */
public class InsertionSort {
    public void sort(int[] array) {
        for (int i = 1; i < array.length; i++) {
            int current = array[i];
            int j = i -1;
            while (j >= 0 && array[j] > current) {
                 array[j + 1] = array[j];
                 j--;
            }
            array[j + 1] = current;
        }
    }
}
